<?php
class M_entrance_test_results extends CI_Model {
	
	private $__table = 'entrance_test_results';
	
	function get_entrance_test_result($enrollment_id)
	{
		$sql = "SELECT * FROM entrance_test_results WHERE e_id = ?";
		$query = $this->db->query($sql, array($enrollment_id));
		return $query->num_rows() > 0 ? $query->row() : FALSE;
	}
	
	//Create
	function insert_entrance_test_result($data)
	{
		$data['created_at'] = NOW;
		$this->db->insert($this->__table,$data);
		return $this->db->affected_rows() > 0 ? TRUE : FALSE;
	}
	
	/* Update ========================================= */
	function update_entrance_test_result($id, $data){
		$this->db->where('e_id', $id)->update('entrance_test_results', $data);
		return $this->db->affected_rows() >= 1 ? TRUE : FALSE;
	}
}
?>
